// 解析歌词
export function parseLyrics(lyrics) {
    const result = [];
    const regExp = /\[(\d{2}):(\d{2})\.(\d{2,3})\]/g;
    const lyricsArr = lyrics.split('\n');
    for (const lyricsItem of lyricsArr) {
        if(!lyricsItem) continue;
        lyrics = regExp.exec(lyricsItem);
        // 分钟
        const minute = lyrics[1];

        // 秒钟
        const second = lyrics[2];

        // 毫秒
        const millisecond = lyrics[3].length === 3 ? lyrics[3] : lyrics[3] + '0';
        const time = minute * 60 * 1000 + second * 1000 + parseFloat(millisecond);
        result.push({time, text: lyricsItem.replace(regExp, '')})
    }
    return result;
}